<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('销项发票详情')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
	<style>
		.file-preview {
		    padding: 0;
		    margin-bottom: 0;
		    border-radius: 0;
		    border: none;
		}
		
		.krajee-default.file-preview-frame {
		    margin-right: 20px;
		    padding: 0;
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default.file-preview-frame:not(.file-preview-error):hover {
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default .file-footer-caption {
			margin-bottom: 0;
		}
		
		.krajee-default.file-preview-frame .file-thumbnail-footer {
		    height: auto;
		}
		
		.krajee-default .file-caption-info {
			width: auto;
		}
		
		.kv-upload-progress .progress {
			margin-top: 0;
		}
		
		.krajee-default.file-preview-frame .kv-file-content,
		.krajee-default .file-size-info,
		.krajee-default .file-upload-indicator,
		.file-input .kv-file-upload,
		.file-input .kv-file-zoom {
			display: none;
		}
		
		.file-input .kv-file-remove {
			position: absolute;
			top: 3px;
			right: -15px;
			height: 14px;
			padding: 0;
			margin: 0;
			border: none;
			background: none;
		}
		
		.file-input .kv-file-remove:active, 
		.file-input .kv-file-remove:focus {
			background: none;
			outline: none;
			box-shadow: none;
		}
		
		.file-input .kv-file-remove .glyphicon-trash {
			color: red;
		}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-sqkpfp-edit" th:object="${gcFkfp}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="gcProjectid" th:field="*{gcProjectid}" class="form-control" type="hidden">
            <input name="projectId" th:field="*{projectId}" class="form-control" type="hidden">
            <input name="orderNo" th:field="*{orderNo}" class="form-control" type="hidden">
            <input type="hidden" id="fap" name="fap" th:field="*{fap}" />
            <input type="hidden" id="fapvo" name="fapvo" th:value="${fapvo}" />
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目编号：</label>
                <div class="col-sm-8">
                    <input name="projectNo" th:field="*{projectNo}" class="form-control" type="text" autoComplete="off" readonly="readonly" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目名称：</label>
                <div class="col-sm-8">
                    <input name="xmmc" th:field="*{xmmc}" class="form-control" type="text" autoComplete="off" readonly="readonly" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">单位名称：</label>
                <div class="col-sm-8">
                	<input name="ckdw" th:field="*{ckdw}" class="form-control" type="text" autoComplete="off" readonly="readonly" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发票编号(后6位)：</label>
                <div class="col-sm-8">
                    <input name="fpNo" th:field="*{fpNo}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group"> 
            	<label class="col-sm-3 control-label is-required">开票日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="fpriq" th:value="${#dates.format(gcFkfp.fpriq, 'yyyy-MM-dd')}" required class="form-control" placeholder="yyyy-MM-dd" type="text" autoComplete="off">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发票类型：</label>
                <div class="col-sm-8">
                	<select name="fpType" th:field="*{fpType}" class="form-control" required>
						<option th:value="专用发票">专用发票</option>
			            <option th:value="普通发票">普通发票</option>
			            <option th:value="其他选项">其他选项</option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发票税率：</label>
                <div class="col-sm-8">
		            <select name="fpsl" th:field="*{fpsl}" class="form-control" required>
			            <option th:value="9">9%</option>
		                <option th:value="6">6%</option>
		                <option th:value="3">3%</option>
		                <option th:value="1">1%</option>
		                <option th:value="0">0%</option>
		                <option th:value="11">11%</option>
		                <option th:value="13">13%</option>
		         	</select>
	            </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发票金额：</label>
                <div class="col-sm-8">
                    <input name="fpjine" th:field="*{fpjine}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">增值税税额：</label>
                <div class="col-sm-8">
                    <input name="kdkse" th:field="*{kdkse}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">销项发票：</label>
                <div class="col-sm-8" style="margin-top: 8px;" id="zlwjlink"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="memo" class="form-control">[[*{memo}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script th:src="@{/ruoyi/base64.min.js?v=20231208}"></script>
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: bootstrap-suggest-js" />
    <th:block th:include="include :: bootstrap-typeahead-js" />
    <script th:src="@{/js/jquery.tmpl.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/sqkpfp";
        $("#form-sqkpfp-edit").validate({
            focusCleanup: true
        });
        
        $(function() {
			var zilwj = $("#fapvo").val();
        	
        	var n=zilwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
//         		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        		var url = n[i];
        		$("#zlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;");
        		$("#zlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        });

        function submitHandler() {
            if ($.validate.form()) {
            	if($("#fap").val()===""){
            		$.modal.alertWarning("请上传发票文件！");
            		return;
            	}
            	var form = document.getElementById("form-sqkpfp-edit");
                var file = new FormData(form);
                $.ajax({
                    url: "/gcgl/sqkpfp/edit",
                    type: "POST",
                    processData:false,
                    contentType:false,
                    //重要部分，data的传的是整个表单，不用大括号包裹；不用自定义变量名
                    data:file,
                    success: function (data) {
                    	$.modal.close();
                    	refreshTab();
                    },
                    error: function (data) {
                    	$.modal.close();
                    	refreshTab();
                    }
                })
            }
        }
        
        $("input[name='fpriq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>